import request from '@/router/axios';

export const productList = (templateName,createNames,pageNo, pageSize) => { // 查询产品模板列表
  return request({
    url: '/api/blade-marketing/marketingProductTemplate/page',
    method: 'get',
    params:{
      templateName,
      createNames,
      pageNo,
      pageSize
    }
  })
}

export const saveProduct = (form) => { // 新增产品模板列表
  return request({
    url: '/api/blade-marketing/marketingProductTemplate',
    method: 'post',
    data:form
  })
}

export const productTemplateDetail = (id) => { // 查询产品模板详情
  return request({
    url: `/api/blade-marketing/marketingProductTemplate/${id}`,
    method: 'get'
  })
}

export const deleteRow = (id) => { // 删除单个产品模板
  return request({
    url: `/api/blade-marketing/marketingProductTemplate/${id}`,
    method: 'delete'
  })
}
export const editProduct = (id, form) => { // 修改单个模板
  return request.put(`/api/blade-marketing/marketingProductTemplate/${id}`, form)
}

export const changeShare = (id, en) => { //启用开关
  return request.put(`/api/blade-marketing/marketingProductTemplate/${id}/share/${en}`)
}
export const copyRule = (id,name) => { //复制
  return request.put(`/api/blade-marketing/marketingProductTemplate/${id}/copy?templateName=${name}`)
}
export const getNextMan = () => {
  return request({
    url: '/api/blade-marketing/marketingProductTemplate/createNames',
    method: 'get'
  })
}
